wayland: fix up/down mix up in discrete events
authorOlivier Fourdan <ofourdan@redhat.com>
Tue, 3 May 2016 08:44:16 +0000 (10:44 +0200)
committerOlivier Fourdan <ofourdan@redhat.com>
Tue, 3 May 2016 09:38:06 +0000 (11:38 +0200)
The wayland specification for discrete step information for scroll and
other axes reads:

| The discrete value carries the directional information. e.g. a
| value of -2 is two steps towards the negative direction of this axis.

mutter sets a value of 1 for SCROLL_DOWN events and -1 for SCROLL_UP
events.

gdkdevice Wayland backend does the opposite, it translates a positive
discrete value as SCROLL_UP and a negative value as SCROLL_DOWN, which
ends up inverting the scrolling direction.

Fix the logic in gdkdevice Wayland to use a positive value as
SCROLL_DOWN and a negative value as SCROLL_UP so that it matches mutter
and weston logic.

https://bugzilla.gnome.org/show_bug.cgi?id=765907

gdk/wayland/gdkdevice-wayland.c

index ae564ab966142b479653f756d0af75bba58341fc..13a791728290a6991368b4553462de49abf23e3b 100644 (file)
@@ -1138,9 +1138,9 @@ flush_scroll_event (GdkWaylandSeat             *seat,
       else if (pointer_frame->discrete_x < 0)
         direction = GDK_SCROLL_RIGHT;
       else if (pointer_frame->discrete_y > 0)
-        direction = GDK_SCROLL_UP;
-      else
         direction = GDK_SCROLL_DOWN;
+      else
+        direction = GDK_SCROLL_UP;
 
       flush_discrete_scroll_event (seat, direction);
       pointer_frame->discrete_x = 0;